package com.appoint.web.controller.buss;

import com.appoint.buss.domain.EpiparaAtacInfo;
import com.appoint.buss.service.IEpiparaAtacInfoService;
import com.appoint.common.annotation.Log;
import com.appoint.common.core.controller.BaseController;
import com.appoint.common.core.domain.AjaxResult;
import com.appoint.common.core.page.TableDataInfo;
import com.appoint.common.enums.BusinessType;
import com.appoint.common.utils.poi.ExcelUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * atacInfoController
 *
 * @author appoint
 * @date 2023-02-18
 */
@RestController
@RequestMapping("/buss/atacInfo")
public class EpiparaAtacInfoController extends BaseController
{
    @Autowired
    private IEpiparaAtacInfoService EpiparaAtacInfoService;

    /**
     * 查询atacInfo列表
     */
    @PreAuthorize("@ss.hasPermi('buss:atac:list')")
    @GetMapping("/list")
    public TableDataInfo list(EpiparaAtacInfo EpiparaAtacInfo)
    {
        startPage();
        List<com.appoint.buss.domain.EpiparaAtacInfo> list = EpiparaAtacInfoService.selectEpiparaAtacInfoList(EpiparaAtacInfo);
        return getDataTable(list);
    }

    /**
     * 导出atacInfo列表
     */
    @PreAuthorize("@ss.hasPermi('buss:atac:export')")
    @Log(title = "atacInfo", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EpiparaAtacInfo EpiparaAtacInfo)
    {
        List<com.appoint.buss.domain.EpiparaAtacInfo> list = EpiparaAtacInfoService.selectEpiparaAtacInfoList(EpiparaAtacInfo);
        ExcelUtil<com.appoint.buss.domain.EpiparaAtacInfo> util = new ExcelUtil<>(com.appoint.buss.domain.EpiparaAtacInfo.class);
        util.exportExcel(response, list, "atacInfo数据");
    }

    /**
     * 获取atacInfo详细信息
     */
    @PreAuthorize("@ss.hasPermi('buss:atac:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(EpiparaAtacInfoService.selectEpiparaAtacInfoById(id));
    }

    /**
     * 新增atacInfo
     */
    @PreAuthorize("@ss.hasPermi('buss:atac:add')")
    @Log(title = "atacInfo", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EpiparaAtacInfo EpiparaAtacInfo)
    {
        return toAjax(EpiparaAtacInfoService.insertEpiparaAtacInfo(EpiparaAtacInfo));
    }

    /**
     * 修改atacInfo
     */
    @PreAuthorize("@ss.hasPermi('buss:atac:edit')")
    @Log(title = "atacInfo", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EpiparaAtacInfo EpiparaAtacInfo)
    {
        return toAjax(EpiparaAtacInfoService.updateEpiparaAtacInfo(EpiparaAtacInfo));
    }

    /**
     * 删除atacInfo
     */
    @PreAuthorize("@ss.hasPermi('buss:atac:remove')")
    @Log(title = "atacInfo", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(EpiparaAtacInfoService.deleteEpiparaAtacInfoByIds(ids));
    }
}
